package crp.infra.test.builders;

import crp.core.department.domain.models.DepartmentEntity;
import crp.core.shared.LifecycleStatus;
import crp.infra.test.utils.Randoms;

import javax.enterprise.context.Dependent;

@Dependent
public class DepartmentEntityBuilder extends AuditedEntityBuilder<DepartmentEntity, DepartmentEntityBuilder> {

    private String code;
    private String name;
    private LifecycleStatus status;

    @Override
    protected DepartmentEntity preBuild() {
        DepartmentEntity entity = new DepartmentEntity();
        entity.setCode(this.code);
        entity.setName(this.name);
        entity.setStatus(this.status);
        return entity;
    }

    public DepartmentEntityBuilder any() {
        this.code = Randoms.randomCode();
        this.name = Randoms.randomString();
        this.status = Randoms.randomEnum(LifecycleStatus.class);
        return this;
    }
}
